{% extends "@CoreBundle/layout/pop.html.twig" %}

{% block page_title %}编辑试题{% endblock %}
{% block breadcrumb %}
  <li class="breadcrumb-item"><a href="{{ path("qa_admin_node_index", {chapterId:chapterId, chapterSubId:chapterSubId}) }}">试题管理</a></li>
{% endblock %}

{% block page %}
<div class="card" >
  <form method="POST" action="{{ path("qa_admin_node_do_edit", {id:id}) }}" class="form-horizontal ajaxform needs-validation" accept-charset="UTF-8" novalidate>
    <div class="card-body" style="display: block;">
      {{ formData|raw }}
      <div class="form-group  row " id="choose">
        <label for="title" class="col-sm-2 require col-form-label" >选择项:</label>
        <div class="col-sm-8">
          <div class="input-group">
            A、<input type="text" style="margin-bottom: 10px;" name="choose[]" class="form-control form-control-sm" value="{{ if_set(info['sub']['options'], 0, '') }}" />
          </div>
          <div class="input-group">
            B、<input type="text" style="margin-bottom: 10px;"  name="choose[]" class="form-control form-control-sm" value="{{ if_set(info['sub']['options'], 1, '') }}" />
          </div>
          <div class="input-group">
            C、<input type="text" style="margin-bottom: 10px;"  name="choose[]" class="form-control form-control-sm" value="{{ if_set(info['sub']['options'], 2, '') }}" />
          </div>
          <div class="input-group">
            D、<input type="text" style="margin-bottom: 10px;"  name="choose[]" class="form-control form-control-sm" value="{{ if_set(info['sub']['options'], 3, '') }}" />
          </div>
          <div class="input-group">
            E、<input type="text" style="margin-bottom: 10px;"  name="choose[]" class="form-control form-control-sm" value="{{ if_set(info['sub']['options'], 4, '') }}" />
          </div>
        </div>
      </div>
      <div class="form-group  row">
        <label for="title" class="col-sm-2 require col-form-label" >答案:</label>
        <div class="col-sm-8">
          <div class="input-group">
            <input type="text" name="answer" class="form-control form-control-sm" value="{{ info['sub']['answer'] }}" placeholder="多个答案使用'|'隔开,答案中有'|'使用'\|'替代;在答案后加':'加答案分数" />
          </div>
        </div>
      </div>
    </div>
    <div class="card-footer">
      <div class="col-md-2"></div>
      <div class="col-md-8">
        <div class="btn-group">
          <button type="submit" class="btn btn-sm btn-info " style="margin-right: 10px;">提交</button>
          <button type="reset" class="btn btn-default btn-sm reset"><i class="fa fa-undo"></i>&nbsp;&nbsp;重置</button>
        </div>
      </div>
    </div>
  </form>
</div>
{% endblock %}

{% block body_custom_javascript %}
  <script>
    $("#type").change(function(){
      var vl = $(this).val();
      if(vl <3){
        $("#choose").show();
      }else{
        $("#choose").hide();
      }
    });

    var vl = $("#type").val();
    if(vl <3){
      $("#choose").show();
    }else{
      $("#choose").hide();
    }

  </script>
{% endblock %}
